import {Http} from '../utils/http'

class Home {
    static async getHomeData() {
        const res = await Http.request({
            url: `home/info`,
            method: 'GET'
        })
        return res.data
    }

    static async getProductDetail() {
        const res = await Http.request({
            url: `home/detail`,
            method: 'GET'
        })
        return res.data
    }

    static async onMessage(advise) {
        const res = await Http.request({
            url: `coin/advise`,
            data: { advise }
        })
        return res.status
    }

    static async getUserAccount() {
        const res = await Http.request({
            url: `coin/use/coin`,
            method: 'GET'
        })
        return res.data
    }

    static async exchangeCoinByCode(code) {
        const res = await Http.request({
            url: `coin/take?code=${code}`,
            method: 'GET'
        })
        return res
    }
}

export {Home}
